/**
 * 
 *汇付天下有限公司
 * Copyright (c) 2006-2013 ChinaPnR,Inc.All Rights Reserved.
 */
package com.zx.screener.service.userCenter.service.impl;

import java.util.List;

import org.apache.log4j.Logger;
import org.springframework.data.mongodb.core.MongoTemplate;

import com.zx.screener.service.userCenter.model.User;
import com.zx.screener.service.userCenter.service.UsrService;

/**
 * 
 * @author zhanghaijie
 * @version $Id: LoginServiceImpl.java, v 0.1 2013-3-7 上午10:55:43 zhanghaijie
 *          Exp $
 */
public class UsrServiceImpl implements UsrService {

	private static final Logger logger = Logger.getLogger(UsrServiceImpl.class);

	private MongoTemplate mongoTemplate;

	/**
	 * 查询用户
	 * 
	 * @see com.zx.screener.service.userCenter.service.LoginService#Login(java.lang.String,
	 *      java.lang.String)
	 */
	@Override
	public List<User> queryUsr() throws Exception {
		return mongoTemplate.findAll(User.class);
	}

	/**
	 * 修改用户
	 */
	@Override
	public void updateUsr(User user) throws Exception {
		try {
			// TODO 修改用户
		} catch (Exception e) {
			// logger.warn("User does not exist" + loginNum, e);
		}
		// throw new
		// UserCenterServiceException(UserCenterEnum.LOGIN_ERROR.getErrorCode());
	}

	/**
	 * 新增用户
	 */
	@Override
	public void insertUsr(User user) {
		mongoTemplate.insert(user);
	}

	/**
	 * 删除用户
	 */
	@Override
	public void deleteUsr(User user) throws Exception {
		try {
			// TODO 删除用户
		} catch (Exception e) {
			// logger.warn("User does not exist" + loginNum, e);
		}
		// throw new
		// UserCenterServiceException(UserCenterEnum.LOGIN_ERROR.getErrorCode());
	}

	public void setMongoTemplate(MongoTemplate mongoTemplate) {
		this.mongoTemplate = mongoTemplate;
	}

}
